import React, { Component } from 'react'
import { Button, Col, Popconfirm, Row } from 'antd'
import { PoweroffOutlined, IdcardOutlined, FormOutlined } from '@ant-design/icons'
import Cookies from 'js-cookie'
import { resumeApi } from '../../utils'

import './index.less'

//选择 填写履历表 或者 进入考试
export default class Admin extends Component {

    //退出
    skipToLogin = () => {
        Cookies.remove('answerToken')
        this.props.history.replace('/login')
    }
    
    //进入考试
    enterExam = () => {
        this.props.history.push('/paper')
    }

    render() {
        return (
            <div className='admin'>
                {/* <div className="bg"></div> */}
                <header className="header">
                    <Popconfirm onConfirm={this.skipToLogin} title='您确定要退出登录吗?' cancelText='取消' okText='确定'>
                        <Button className="header-btn" type='text' icon={<PoweroffOutlined />} >退出</Button>
                    </Popconfirm>
                </header>
                <div className="btn-content">
                    <Row gutter={64}>
                        <Col span={12}>
                            <a href={`${resumeApi}${Cookies.get('answerToken')}`} target='_blank' rel='noopener noreferrer'>
                                <div className="my-admin-btn my-resume">
                                    <IdcardOutlined style={{ fontSize: 70 }} />
                                    <p>填写履历表</p>
                                </div>
                            </a>
                        </Col>
                        <Col span={12}>
                            <div className="my-admin-btn my-exam" onClick={this.enterExam}>
                                <FormOutlined style={{ fontSize: 70 }} />
                                <p>进入考试</p>
                            </div>
                        </Col>
                    </Row>
                </div>
            </div>
        )
    }
}